<?php
include  '../loginCheck.php';
include  '../Util.php';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <title>Technology</title>
        <link rel="stylesheet" type="text/css" href="view.css" media="all"/>
        <script type="text/javascript" src="view.js"></script>

    </head>
    <body id="main_body" >

        <img id="top" src="top.png" alt=""/>
        <div id="form_container">
            <h1>
                <?php
                include  'menu.php';
                ?>
            </h1>
            <form id="form_144887" class="appnitro" enctype="multipart/form-data" method="post" action="../adminResolveTechnology.php">
                <div class="form_description">
                    <h2>Technology</h2>
                    <p>Editing or creating new technology section. You can use html tags.</p>
                </div>                
                <?php
                $link = Util::getLink();

                if (isset($_GET['sectionId'])) {

                    $query = sprintf(Util::$select_jornakTechnologyBySectionId,
                        mysql_real_escape_string($_GET['sectionId'])
                    );

                    $result = mysql_query($query);

                    if (!$result) {
                        die('Could not query:' . mysql_error());
                    }

                    $row = mysql_fetch_assoc($result);
                    ?>
                <ul >
                    <li id="li_1" >
                        <label class="description" for="element_1">Headline </label>
                        <div>
                            <input id="element_1" name="element_1" class="element text medium" type="text" maxlength="255" value="<?php echo stripslashes($row['headline']);?>"/>
                        </div><p class="guidelines" id="guide_1"><small>Headline</small></p>
                    </li>		<li id="li_2" >
                        <label class="description" for="element_2">Edit text </label>
                        <div>
                            <textarea id="element_2" name="element_2" class="element textarea large"><?php echo stripslashes($row['text']);?></textarea>
                        </div><p class="guidelines" id="guide_2"><small>Edit text</small></p>
                    </li>			<li id="li_4" >
                        <label class="description" for="element_4">Edit list </label>
                        <div>
                            <textarea id="element_4" name="element_4" class="element textarea large"><?php echo stripslashes($row['list']);?></textarea>
                        </div><p class="guidelines" id="guide_4"><small>Edit list</small></p>
                    </li>		<li id="li_5" >
                        <label class="description" for="element_5">Image 1 </label>
                        <div>
                            <input id="element_5" name="element_5" class="element file" type="file"/>
                        </div> <p class="guidelines" id="guide_5"><small>Image 1. Empty will use old image.</small></p>
                    </li>		<li id="li_6" >
                        <label class="description" for="element_6">Image 2</label>
                        <div>
                            <input id="element_6" name="element_6" class="element file" type="file"/>
                        </div> <p class="guidelines" id="guide_6"><small>Image 2. Empty will use old image.</small></p>
                    </li>		<li id="li_7" >
                        <label class="description" for="element_7">Image 3 </label>
                        <div>
                            <input id="element_7" name="element_7" class="element file" type="file"/>
                        </div> <p class="guidelines" id="guide_7"><small>Image 3. Empty will use old image.</small></p>
                    </li>		<li id="li_8" >
                        <label class="description" for="element_8">Image 4 </label>
                        <div>
                            <input id="element_8" name="element_8" class="element file" type="file"/>
                        </div> <p class="guidelines" id="guide_8"><small>Image 4. Empty will use old image.</small></p>
                    </li>		<li id="li_9" >
                        <label class="description" for="element_9">Image 5 </label>
                        <div>
                            <input id="element_9" name="element_9" class="element file" type="file"/>
                        </div> <p class="guidelines" id="guide_9"><small>Image 5. Empty will use old image.</small></p>
                    </li>		<li id="li_11" >
                        <label class="description" for="element_10">Image 6 </label>
                        <div>
                            <input id="element_10" name="element_10" class="element file" type="file"/>
                        </div> <p class="guidelines" id="guide_10"><small>Image 6. Empty will use old image.</small></p>
                    </li>		<li id="li_11" >
                        <label class="description" for="element_11">Image 7 </label>
                        <div>
                            <input id="element_11" name="element_11" class="element file" type="file"/>
                        </div> <p class="guidelines" id="guide_11"><small>Image 7. Empty will use old image.</small></p>
                    </li>		<li id="li_12" >
                        <label class="description" for="element_12">Image 8 </label>
                        <div>
                            <input id="element_12" name="element_12" class="element file" type="file"/>
                        </div> <p class="guidelines" id="guide_12"><small>Image 8. Empty will use old image.</small></p>
                    </li>		<li id="li_13" >
                        <label class="description" for="element_13">Image 9 </label>
                        <div>
                            <input id="element_13" name="element_13" class="element file" type="file"/>
                        </div> <p class="guidelines" id="guide_13"><small>Image 9. Empty will use old image.</small></p>
                    </li>		<li id="li_14" >
                        <label class="description" for="element_14">Image 10 </label>
                        <div>
                            <input id="element_14" name="element_14" class="element file" type="file"/>
                        </div> <p class="guidelines" id="guide_14"><small>Image 10. Empty will use old image.</small></p>
                    </li>

                    <li class="buttons">
                        <input type="hidden" name="form_id" value="144887" />

                        <input id="saveForm" class="button_text" type="submit" name="submit" value="Submit" />
                    </li>
                </ul>
                <input type="hidden" name="form_type" value="3" />
                <input type="hidden" name="images" value="<?php echo $row['imgs'];?>" />
                <input type="hidden" name="section" value="<?php echo $_GET['sectionId'];?>" />
                <?

                }else {
                    $query = sprintf(Util::$technologySection_selectAll
                    );

                    $result = mysql_query($query);

                    if (!$result) {
                        die('Could not query:' . mysql_error());
                    }

                    ?>
                <ul>
                    <li id="li_1" >
                        <label class="description" for="element_1">Chose technology section </label>
                        <div>
                            <select class="element select medium" id="element_1" name="element_1">
                                    <?php
                                    $i = true;
                                    while ($row = mysql_fetch_assoc($result)) {
                                        if ($i) {
                                            echo ('<option value="'.$row['id'].'" selected="selected">'.stripslashes($row['name']).'</option>');
                                            $i = false;
                                        }else {
                                            echo ('<option value="'.$row['id'].'">'.stripslashes($row['name']).'</option>');
                                        }
                                    }
                                    ?>
                            </select>
                        </div><p class="guidelines" id="guide_1"><small>Your uploaded file will appear in chosed section.</small></p>
                    </li>
                    <li class="buttons">
                        <input type="hidden" name="form_id" value="144887" />

                        <input id="saveForm" class="button_text" type="submit" name="submit" value="Submit" />
                    </li>
                </ul>
                <input type="hidden" name="choseSection" value="true" />
                <?php
                }
                Util::closeLink($link);

                ?>

            </form>
            <div id="footer">

            </div>
        </div>
        <img id="bottom" src="bottom.png" alt=""/>
    </body>
</html>